package com.ruoyi.building.service.impl;

import java.util.Date;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.building.mapper.BuildingMapper;
import com.ruoyi.building.domain.Building;
import com.ruoyi.building.service.IBuildingService;

/**
 * 楼栋Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-04-07
 */
@Service
public class BuildingServiceImpl implements IBuildingService 
{
    @Autowired
    private BuildingMapper buildingMapper;

    /**
     * 查询楼栋
     * 
     * @param id 楼栋主键
     * @return 楼栋
     */
    @Override
    public Building selectBuildingById(Long id)
    {
        return buildingMapper.selectBuildingById(id);
    }

    /**
     * 查询楼栋列表
     * 
     * @param building 楼栋
     * @return 楼栋
     */
    @Override
    public List<Building> selectBuildingList(Building building)
    {
        return buildingMapper.selectBuildingList(building);
    }

    /**
     * 新增楼栋
     * 
     * @param building 楼栋
     * @return 结果
     */
    @Override
    public int insertBuilding(Building building)
    {
        building.setCreateTime(new Date());
        return buildingMapper.insertBuilding(building);
    }

    /**
     * 修改楼栋
     * 
     * @param building 楼栋
     * @return 结果
     */
    @Override
    public int updateBuilding(Building building)
    {
        building.setUpdateTime(new Date());
        return buildingMapper.updateBuilding(building);
    }

    /**
     * 批量删除楼栋
     * 
     * @param ids 需要删除的楼栋主键
     * @return 结果
     */
    @Override
    public int deleteBuildingByIds(Long[] ids)
    {
        return buildingMapper.deleteBuildingByIds(ids);
    }

    /**
     * 删除楼栋信息
     * 
     * @param id 楼栋主键
     * @return 结果
     */
    @Override
    public int deleteBuildingById(Long id)
    {
        return buildingMapper.deleteBuildingById(id);
    }

    @Override
    public Building buildingGetInfo(Long id) {
        return buildingMapper.selectBuildingById(id);
    }
}
